home *** CD-ROM | disk | FTP | other *** search
/ This Disc Bytes! / Power Computing - The Disc 2 - This Disc Bytes.ISO / mac / CodeWarrior 7 Lite for 68K / MacOS Support / Headers / Universal Headers / AEObjects.h < prev    next >
Text File  |  1995-07-06  |  16KB  |  354 lines

  1. /*
  2.      File:        AEObjects.h
  3.  
  4.      Contains:    AppleEvents Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Package:    Universal Interfaces 2.1 in “MPW Latest” on ETO #18
  8.  
  9.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13.                  stack.  Include the file and version information (from above)
  14.                  in the problem description and send to:
  15.                      Internet:    apple.bugs@applelink.apple.com
  16.                      AppleLink:    APPLE.BUGS
  17.  
  18. */
  19.  
  20. #ifndef __AEOBJECTS__
  21. #define __AEOBJECTS__
  22.  
  23.  
  24. #ifndef __MEMORY__
  25. #include <Memory.h>
  26. #endif
  27. /*    #include <Types.h>                                            */
  28. /*        #include <ConditionalMacros.h>                            */
  29. /*    #include <MixedMode.h>                                        */
  30.  
  31. #ifndef __OSUTILS__
  32. #include <OSUtils.h>
  33. #endif
  34.  
  35. #ifndef __QUICKDRAW__
  36. #include <Quickdraw.h>
  37. #endif
  38. /*    #include <QuickdrawText.h>                                    */
  39.  
  40. #ifndef __EVENTS__
  41. #include <Events.h>
  42. #endif
  43.  
  44. #ifndef __EPPC__
  45. #include <EPPC.h>
  46. #endif
  47. /*    #include <Errors.h>                                            */
  48. /*    #include <AppleTalk.h>                                        */
  49. /*    #include <Files.h>                                            */
  50. /*        #include <Finder.h>                                        */
  51. /*    #include <PPCToolbox.h>                                        */
  52. /*    #include <Processes.h>                                        */
  53.  
  54. #ifndef __APPLEEVENTS__
  55. #include <AppleEvents.h>
  56. #endif
  57. /*    #include <Notification.h>                                    */
  58.  
  59. #ifndef __ERRORS__
  60. #include <Errors.h>
  61. #endif
  62.  
  63. #ifdef __cplusplus
  64. extern "C" {
  65. #endif
  66.  
  67. #if PRAGMA_ALIGN_SUPPORTED
  68. #pragma options align=mac68k
  69. #endif
  70.  
  71. #if PRAGMA_IMPORT_SUPPORTED
  72. #pragma import on
  73. #endif
  74.  
  75.  
  76. enum {
  77.     kAEAND                        = 'AND ',                        /*  0x414e4420  */
  78.     kAEOR                        = 'OR  ',                        /*  0x4f522020  */
  79.     kAENOT                        = 'NOT ',                        /*  0x4e4f5420  */
  80. /****    ABSOLUTE ORDINAL CONSTANTS    ****/
  81.     kAEFirst                    = 'firs',                        /*  0x66697273  */
  82.     kAELast                        = 'last',                        /*  0x6c617374  */
  83.     kAEMiddle                    = 'midd',                        /*  0x6d696464  */
  84.     kAEAny                        = 'any ',                        /*  0x616e7920  */
  85.     kAEAll                        = 'all ',                        /*  0x616c6c20  */
  86. /****    RELATIVE ORDINAL CONSTANTS    ****/
  87.     kAENext                        = 'next',                        /*  0x6e657874  */
  88.     kAEPrevious                    = 'prev',                        /*  0x70726576  */
  89. /****    KEYWORD CONSTANT     ****/
  90.     keyAECompOperator            = 'relo',                        /*  0x72656c6f  */
  91.     keyAELogicalTerms            = 'term',                        /*  0x7465726d  */
  92.     keyAELogicalOperator        = 'logc',                        /*  0x6c6f6763  */
  93.     keyAEObject1                = 'obj1',                        /*  0x6f626a31  */
  94.     keyAEObject2                = 'obj2',                        /*  0x6f626a32  */
  95. /*    ... for Keywords for getting fields out of object specifier records. */
  96.     keyAEDesiredClass            = 'want',                        /*  0x77616e74  */
  97.     keyAEContainer                = 'from',                        /*  0x66726f6d  */
  98.     keyAEKeyForm                = 'form',                        /*  0x666f726d  */
  99.     keyAEKeyData                = 'seld'
  100. };
  101.  
  102. enum {
  103. /*    ... for Keywords for getting fields out of Range specifier records. */
  104.     keyAERangeStart                = 'star',                        /*  0x73746172  */
  105.     keyAERangeStop                = 'stop',                        /*  0x73746f70  */
  106. /*    ... special handler selectors for OSL Callbacks. */
  107.     keyDisposeTokenProc            = 'xtok',                        /*  0x78746f6b  */
  108.     keyAECompareProc            = 'cmpr',                        /*  0x636d7072  */
  109.     keyAECountProc                = 'cont',                        /*  0x636f6e74  */
  110.     keyAEMarkTokenProc            = 'mkid',                        /*  0x6d6b6964  */
  111.     keyAEMarkProc                = 'mark',                        /*  0x6d61726b  */
  112.     keyAEAdjustMarksProc        = 'adjm',                        /*  0x61646a6d  */
  113.     keyAEGetErrDescProc            = 'indc'
  114. };
  115.  
  116. /****    VALUE and TYPE CONSTANTS    ****/
  117. enum {
  118. /*    ... possible values for the keyAEKeyForm field of an object specifier. */
  119.     formAbsolutePosition        = 'indx',                        /*  0x696e6478  */
  120.     formRelativePosition        = 'rele',                        /*  0x72656c65  */
  121.     formTest                    = 'test',                        /*  0x74657374  */
  122.     formRange                    = 'rang',                        /*  0x72616e67  */
  123.     formPropertyID                = 'prop',                        /*  0x70726f70  */
  124.     formName                    = 'name',                        /*  0x6e616d65  */
  125. /*    ... relevant types (some of these are often pared with forms above). */
  126.     typeObjectSpecifier            = 'obj ',                        /*  0x6f626a20  */
  127.     typeObjectBeingExamined        = 'exmn',                        /*  0x65786d6e  */
  128.     typeCurrentContainer        = 'ccnt',                        /*  0x63636e74  */
  129.     typeToken                    = 'toke',                        /*  0x746f6b65  */
  130.     typeRelativeDescriptor        = 'rel ',                        /*  0x72656c20  */
  131.     typeAbsoluteOrdinal            = 'abso',                        /*  0x6162736f  */
  132.     typeIndexDescriptor            = 'inde',                        /*  0x696e6465  */
  133.     typeRangeDescriptor            = 'rang',                        /*  0x72616e67  */
  134.     typeLogicalDescriptor        = 'logi',                        /*  0x6c6f6769  */
  135.     typeCompDescriptor            = 'cmpd',                        /*  0x636d7064  */
  136.     typeOSLTokenList            = 'ostl'
  137. };
  138.  
  139. /* Possible values for flags parameter to AEResolve.  They're additive */
  140. enum {
  141.     kAEIDoMinimum                = 0x0000,
  142.     kAEIDoWhose                    = 0x0001,
  143.     kAEIDoMarking                = 0x0004,
  144.     kAEPassSubDescs                = 0x0008,
  145.     kAEResolveNestedLists        = 0x0010,
  146.     kAEHandleSimpleRanges        = 0x0020,
  147.     kAEUseRelativeIterators        = 0x0040
  148. };
  149.  
  150. /**** SPECIAL CONSTANTS FOR CUSTOM WHOSE-CLAUSE RESOLUTION */
  151. enum {
  152.     typeWhoseDescriptor            = 'whos',                        /*  0x77686f73  */
  153.     formWhose                    = 'whos',                        /*  0x77686f73  */
  154.     typeWhoseRange                = 'wrng',                        /*  0x77726e67  */
  155.     keyAEWhoseRangeStart        = 'wstr',                        /*  0x77737472  */
  156.     keyAEWhoseRangeStop            = 'wstp',                        /*  0x77737470  */
  157.     keyAEIndex                    = 'kidx',                        /*  0x6b696478  */
  158.     keyAETest                    = 'ktst'
  159. };
  160.  
  161. /**
  162.     used for rewriting tokens in place of 'ccnt' descriptors
  163.     This record is only of interest to those who, when they...
  164.     ...get ranges as key data in their accessor procs, choose
  165.     ...to resolve them manually rather than call AEResolve again.
  166. **/
  167. struct ccntTokenRecord {
  168.     DescType                        tokenClass;
  169.     AEDesc                            token;
  170. };
  171. typedef struct ccntTokenRecord ccntTokenRecord, *ccntTokenRecPtr, **ccntTokenRecHandle;
  172.  
  173. #if OLDROUTINENAMES
  174. typedef AEDesc *DescPtr, **DescHandle;
  175.  
  176. #endif
  177. typedef pascal OSErr (*OSLAccessorProcPtr)(DescType desiredClass, const AEDesc *container, DescType containerClass, DescType form, const AEDesc *selectionData, AEDesc *value, long accessorRefcon);
  178. typedef pascal OSErr (*OSLCompareProcPtr)(DescType oper, const AEDesc *obj1, const AEDesc *obj2, Boolean *result);
  179. typedef pascal OSErr (*OSLCountProcPtr)(DescType desiredType, DescType containerClass, const AEDesc *container, long *result);
  180. typedef pascal OSErr (*OSLDisposeTokenProcPtr)(AEDesc *unneededToken);
  181. typedef pascal OSErr (*OSLGetMarkTokenProcPtr)(const AEDesc *dContainerToken, DescType containerClass, AEDesc *result);
  182. typedef pascal OSErr (*OSLGetErrDescProcPtr)(AEDesc **appDescPtr);
  183. typedef pascal OSErr (*OSLMarkProcPtr)(const AEDesc *dToken, const AEDesc *markToken, long index);
  184. typedef pascal OSErr (*OSLAdjustMarksProcPtr)(long newStart, long newStop, const AEDesc *markToken);
  185.  
  186. #if GENERATINGCFM
  187. typedef UniversalProcPtr OSLAccessorUPP;
  188. typedef UniversalProcPtr OSLCompareUPP;
  189. typedef UniversalProcPtr OSLCountUPP;
  190. typedef UniversalProcPtr OSLDisposeTokenUPP;
  191. typedef UniversalProcPtr OSLGetMarkTokenUPP;
  192. typedef UniversalProcPtr OSLGetErrDescUPP;
  193. typedef UniversalProcPtr OSLMarkUPP;
  194. typedef UniversalProcPtr OSLAdjustMarksUPP;
  195. #else
  196. typedef OSLAccessorProcPtr OSLAccessorUPP;
  197. typedef OSLCompareProcPtr OSLCompareUPP;
  198. typedef OSLCountProcPtr OSLCountUPP;
  199. typedef OSLDisposeTokenProcPtr OSLDisposeTokenUPP;
  200. typedef OSLGetMarkTokenProcPtr OSLGetMarkTokenUPP;
  201. typedef OSLGetErrDescProcPtr OSLGetErrDescUPP;
  202. typedef OSLMarkProcPtr OSLMarkUPP;
  203. typedef OSLAdjustMarksProcPtr OSLAdjustMarksUPP;
  204. #endif
  205.  
  206. enum {
  207.     uppOSLAccessorProcInfo = kPascalStackBased
  208.          | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  209.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(DescType)))
  210.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(AEDesc*)))
  211.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(DescType)))
  212.          | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(DescType)))
  213.          | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(AEDesc*)))
  214.          | STACK_ROUTINE_PARAMETER(6, SIZE_CODE(sizeof(AEDesc*)))
  215.          | STACK_ROUTINE_PARAMETER(7, SIZE_CODE(sizeof(long))),
  216.     uppOSLCompareProcInfo = kPascalStackBased
  217.          | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  218.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(DescType)))
  219.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(AEDesc*)))
  220.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(AEDesc*)))
  221.          | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(Boolean*))),
  222.     uppOSLCountProcInfo = kPascalStackBased
  223.          | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  224.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(DescType)))
  225.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(DescType)))
  226.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(AEDesc*)))
  227.          | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(long*))),
  228.     uppOSLDisposeTokenProcInfo = kPascalStackBased
  229.          | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  230.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(AEDesc*))),
  231.     uppOSLGetMarkTokenProcInfo = kPascalStackBased
  232.          | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  233.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(AEDesc*)))
  234.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(DescType)))
  235.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(AEDesc*))),
  236.     uppOSLGetErrDescProcInfo = kPascalStackBased
  237.          | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  238.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(AEDesc**))),
  239.     uppOSLMarkProcInfo = kPascalStackBased
  240.          | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  241.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(AEDesc*)))
  242.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(AEDesc*)))
  243.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(long))),
  244.     uppOSLAdjustMarksProcInfo = kPascalStackBased
  245.          | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  246.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(long)))
  247.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(long)))
  248.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(AEDesc*)))
  249. };
  250.  
  251. #if GENERATINGCFM
  252. #define NewOSLAccessorProc(userRoutine)        \
  253.         (OSLAccessorUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppOSLAccessorProcInfo, GetCurrentArchitecture())
  254. #define NewOSLCompareProc(userRoutine)        \
  255.         (OSLCompareUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppOSLCompareProcInfo, GetCurrentArchitecture())
  256. #define NewOSLCountProc(userRoutine)        \
  257.         (OSLCountUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppOSLCountProcInfo, GetCurrentArchitecture())
  258. #define NewOSLDisposeTokenProc(userRoutine)        \
  259.         (OSLDisposeTokenUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppOSLDisposeTokenProcInfo, GetCurrentArchitecture())
  260. #define NewOSLGetMarkTokenProc(userRoutine)        \
  261.         (OSLGetMarkTokenUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppOSLGetMarkTokenProcInfo, GetCurrentArchitecture())
  262. #define NewOSLGetErrDescProc(userRoutine)        \
  263.         (OSLGetErrDescUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppOSLGetErrDescProcInfo, GetCurrentArchitecture())
  264. #define NewOSLMarkProc(userRoutine)        \
  265.         (OSLMarkUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppOSLMarkProcInfo, GetCurrentArchitecture())
  266. #define NewOSLAdjustMarksProc(userRoutine)        \
  267.         (OSLAdjustMarksUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppOSLAdjustMarksProcInfo, GetCurrentArchitecture())
  268. #else
  269. #define NewOSLAccessorProc(userRoutine)        \
  270.         ((OSLAccessorUPP) (userRoutine))
  271. #define NewOSLCompareProc(userRoutine)        \
  272.         ((OSLCompareUPP) (userRoutine))
  273. #define NewOSLCountProc(userRoutine)        \
  274.         ((OSLCountUPP) (userRoutine))
  275. #define NewOSLDisposeTokenProc(userRoutine)        \
  276.         ((OSLDisposeTokenUPP) (userRoutine))
  277. #define NewOSLGetMarkTokenProc(userRoutine)        \
  278.         ((OSLGetMarkTokenUPP) (userRoutine))
  279. #define NewOSLGetErrDescProc(userRoutine)        \
  280.         ((OSLGetErrDescUPP) (userRoutine))
  281. #define NewOSLMarkProc(userRoutine)        \
  282.         ((OSLMarkUPP) (userRoutine))
  283. #define NewOSLAdjustMarksProc(userRoutine)        \
  284.         ((OSLAdjustMarksUPP) (userRoutine))
  285. #endif
  286.  
  287. #if GENERATINGCFM
  288. #define CallOSLAccessorProc(userRoutine, desiredClass, container, containerClass, form, selectionData, value, accessorRefcon)        \
  289.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppOSLAccessorProcInfo, (desiredClass), (container), (containerClass), (form), (selectionData), (value), (accessorRefcon))
  290. #define CallOSLCompareProc(userRoutine, oper, obj1, obj2, result)        \
  291.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppOSLCompareProcInfo, (oper), (obj1), (obj2), (result))
  292. #define CallOSLCountProc(userRoutine, desiredType, containerClass, container, result)        \
  293.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppOSLCountProcInfo, (desiredType), (containerClass), (container), (result))
  294. #define CallOSLDisposeTokenProc(userRoutine, unneededToken)        \
  295.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppOSLDisposeTokenProcInfo, (unneededToken))
  296. #define CallOSLGetMarkTokenProc(userRoutine, dContainerToken, containerClass, result)        \
  297.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppOSLGetMarkTokenProcInfo, (dContainerToken), (containerClass), (result))
  298. #define CallOSLGetErrDescProc(userRoutine, appDescPtr)        \
  299.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppOSLGetErrDescProcInfo, (appDescPtr))
  300. #define CallOSLMarkProc(userRoutine, dToken, markToken, index)        \
  301.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppOSLMarkProcInfo, (dToken), (markToken), (index))
  302. #define CallOSLAdjustMarksProc(userRoutine, newStart, newStop, markToken)        \
  303.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppOSLAdjustMarksProcInfo, (newStart), (newStop), (markToken))
  304. #else
  305. #define CallOSLAccessorProc(userRoutine, desiredClass, container, containerClass, form, selectionData, value, accessorRefcon)        \
  306.         (*(userRoutine))((desiredClass), (container), (containerClass), (form), (selectionData), (value), (accessorRefcon))
  307. #define CallOSLCompareProc(userRoutine, oper, obj1, obj2, result)        \
  308.         (*(userRoutine))((oper), (obj1), (obj2), (result))
  309. #define CallOSLCountProc(userRoutine, desiredType, containerClass, container, result)        \
  310.         (*(userRoutine))((desiredType), (containerClass), (container), (result))
  311. #define CallOSLDisposeTokenProc(userRoutine, unneededToken)        \
  312.         (*(userRoutine))((unneededToken))
  313. #define CallOSLGetMarkTokenProc(userRoutine, dContainerToken, containerClass, result)        \
  314.         (*(userRoutine))((dContainerToken), (containerClass), (result))
  315. #define CallOSLGetErrDescProc(userRoutine, appDescPtr)        \
  316.         (*(userRoutine))((appDescPtr))
  317. #define CallOSLMarkProc(userRoutine, dToken, markToken, index)        \
  318.         (*(userRoutine))((dToken), (markToken), (index))
  319. #define CallOSLAdjustMarksProc(userRoutine, newStart, newStop, markToken)        \
  320.         (*(userRoutine))((newStart), (newStop), (markToken))
  321. #endif
  322.  
  323. extern pascal OSErr AEObjectInit(void);
  324. /* Not done by inline, but by direct linking into code.  It sets up the pack
  325.   such that further calls can be via inline */
  326. extern pascal OSErr AESetObjectCallbacks(OSLCompareUPP myCompareProc, OSLCountUPP myCountProc, OSLDisposeTokenUPP myDisposeTokenProc, OSLGetMarkTokenUPP myGetMarkTokenProc, OSLMarkUPP myMarkProc, OSLAdjustMarksUPP myAdjustMarksProc, OSLGetErrDescUPP myGetErrDescProcPtr)
  327.  THREEWORDINLINE(0x303C, 0x0E35, 0xA816);
  328. extern pascal OSErr AEResolve(const AEDesc *objectSpecifier, short callbackFlags, AEDesc *theToken)
  329.  THREEWORDINLINE(0x303C, 0x0536, 0xA816);
  330. extern pascal OSErr AEInstallObjectAccessor(DescType desiredClass, DescType containerType, OSLAccessorUPP theAccessor, long accessorRefcon, Boolean isSysHandler)
  331.  THREEWORDINLINE(0x303C, 0x0937, 0xA816);
  332. extern pascal OSErr AERemoveObjectAccessor(DescType desiredClass, DescType containerType, OSLAccessorUPP theAccessor, Boolean isSysHandler)
  333.  THREEWORDINLINE(0x303C, 0x0738, 0xA816);
  334. extern pascal OSErr AEGetObjectAccessor(DescType desiredClass, DescType containerType, OSLAccessorUPP *accessor, long *accessorRefcon, Boolean isSysHandler)
  335.  THREEWORDINLINE(0x303C, 0x0939, 0xA816);
  336. extern pascal OSErr AEDisposeToken(AEDesc *theToken)
  337.  THREEWORDINLINE(0x303C, 0x023A, 0xA816);
  338. extern pascal OSErr AECallObjectAccessor(DescType desiredClass, const AEDesc *containerToken, DescType containerClass, DescType keyForm, const AEDesc *keyData, AEDesc *token)
  339.  THREEWORDINLINE(0x303C, 0x0C3B, 0xA816);
  340.  
  341. #if PRAGMA_IMPORT_SUPPORTED
  342. #pragma import off
  343. #endif
  344.  
  345. #if PRAGMA_ALIGN_SUPPORTED
  346. #pragma options align=reset
  347. #endif
  348.  
  349. #ifdef __cplusplus
  350. }
  351. #endif
  352.  
  353. #endif /* __AEOBJECTS__ */
  354.